home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Skunkware 5
/
Skunkware 5.iso
/
man
/
cat.3
/
FileHndlr.3
< prev
next >
Wrap
Text File
|
1995-07-25
|
8KB
|
133 lines
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr((((3333)))) TTTTkkkk (((( )))) TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr((((3333))))
_________________________________________________________________
NNNNAAAAMMMMEEEE
Tk_CreateFileHandler, Tk_DeleteFileHandler - associate
procedure callback with a file or device
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
####iiiinnnncccclllluuuuddddeeee <<<<ttttkkkk....hhhh>>>>
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr(_i_d, _m_a_s_k, _p_r_o_c, _c_l_i_e_n_t_D_a_t_a)
TTTTkkkk____DDDDeeeelllleeeetttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr(_i_d)
AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
int _i_d (in) Integer identifier for
an open file or device
(such as returned by
ooooppppeeeennnn system call).
int _m_a_s_k (in) Conditions under which
_p_r_o_c should be called:
OR-ed combination of
TTTTKKKK____RRRREEEEAAAADDDDAAAABBBBLLLLEEEE,
TTTTKKKK____WWWWRRRRIIIITTTTAAAABBBBLLLLEEEE, and
TTTTKKKK____EEEEXXXXCCCCEEEEPPPPTTTTIIIIOOOONNNN.
Tk_FileProc *_p_r_o_c (in) Procedure to invoke
whenever the file or
device indicated by _i_d
meets the conditions
specified by _m_a_s_k.
ClientData _c_l_i_e_n_t_D_a_t_a (in) Arbitrary one-word
value to pass to _p_r_o_c.
_________________________________________________________________
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr arranges for _p_r_o_c to be invoked in the
future whenever I/O becomes possible on a file or an
exceptional condition exists for the file. The file is
indicated by _i_d, and the conditions of interest are
indicated by _m_a_s_k. For example, if _m_a_s_k is TTTTKKKK____RRRREEEEAAAADDDDAAAABBBBLLLLEEEE,
then _p_r_o_c will be called when the file is readable. The
callback to _p_r_o_c is made by TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt, so
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr is only useful in programs that
dispatch events through TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt or through other Tk
procedures that call TTTTkkkk____DDDDooooOOOOnnnneeeeEEEEvvvveeeennnntttt, such as TTTTkkkk____MMMMaaaaiiiinnnnLLLLoooooooopppp.
_P_r_o_c should have arguments and result that match the type
TTTTkkkk____FFFFiiiilllleeeePPPPrrrroooocccc:
typedef void Tk_FileProc(
Page 1 (printed 7/23/95)
TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr((((3333)))) TTTTkkkk (((( )))) TTTTkkkk____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr((((3333))))
ClientData _c_l_i_e_n_t_D_a_t_a,
int _m_a_s_k);
The _c_l_i_e_n_t_D_a_t_a parameter to _p_r_o_c is a copy of the _c_l_i_e_n_t_D_a_t_a
argument given to TTTTccccllll____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr when the callback
was created. Typically, _c_l_i_e_n_t_D_a_t_a points to a data
structure containing application-specific information about
the file. _M_a_s_k is an integer mask indicating which of the
requested conditions actually exists for the file; it will
contain a subset of the bits in the _m_a_s_k argument to
TTTTccccllll____CCCCrrrreeeeaaaatttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr.
There may exist only one handler for a given file at a given
time. If TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEEvvvveeeennnnttttHHHHaaaannnnddddlllleeeerrrr is called when a handler
already exists for _i_d, then the _m_a_s_k, _p_r_o_c, and _c_l_i_e_n_t_D_a_t_a
for the new call to TTTTkkkk____CCCCrrrreeeeaaaatttteeeeEEEEvvvveeeennnnttttHHHHaaaannnnddddlllleeeerrrr replace the
information that was previously recorded.
TTTTkkkk____DDDDeeeelllleeeetttteeeeFFFFiiiilllleeeeHHHHaaaannnnddddlllleeeerrrr may be called to delete the file
handler for _i_d; if no handler exists for the file given by
_i_d then the procedure has no effect.
The purpose of file handlers is to enable an application to
respond to X events and other events while waiting for files
to become ready for I/O. For this to work correctly, the
application must use non-blocking I/O operations on the
files for which handlers are declared. Otherwise the
application may be put to sleep if it specifies too large an
input or output buffer; while waiting for the I/O to
complete the application won't be able to service other
events. In BSD-based UNIX systems, non-blocking I/O can be
specified for a file using the ffffccccnnnnttttllll kernel call with the
FFFFNNNNDDDDEEEELLLLAAAAYYYY flag.
KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
callback, file, handler
Page 2 (printed 7/23/95)